package com.pro.service.imple;

import com.pro.mapper.JsDeptAuthorityMapper;
import com.pro.pojo.JsDeptAuthority;
import com.pro.pojo.JsonData;
import com.pro.service.JsDeptAuthorityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 祖铭泽
 * @Date 2022/2/22/0022
 * @description 部门权限 service层 实现类
 */
@Service
public class JsDeptAuthorityServiceImple implements JsDeptAuthorityService {
    @Autowired
    private JsDeptAuthorityMapper jsDeptAuthorityMapper;
    /**
     * @Author 祖铭泽
     * @Date 2022/2/22/0022
     * @description 根据部门id查询多个权限
     */
    @Override
    public JsonData getDeptAuthoritys(Integer deptId) {
        List<Integer> deptAuthoritys = jsDeptAuthorityMapper.getDeptAuthoritys(deptId);
        return deptAuthoritys != null ? JsonData.buildSuccess(deptAuthoritys) : JsonData.buildError("失败");
    }
    /**
     * @Author 祖铭泽
     * @Date 2022/2/23/0022
     * @description 为部门添加多个权限
     */
    @Override
    public JsonData addDeptAuthoritys(JsDeptAuthority jsDeptAuthority) {
        boolean addDeptAuthoritys = jsDeptAuthorityMapper.addDeptAuthoritys(jsDeptAuthority);
        return addDeptAuthoritys ? JsonData.buildSuccess(true) : JsonData.buildError("添加失败");
    }
}
